Remove process env mutation (#177) (#221) - #223
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
aaacec5 to
519396a
Compare
Reviewer's GuideThe PR establishes Sequence diagram for injected environment configurationsequenceDiagram
participant EntryPoint
participant Env as mockable::Env
participant Configuration
EntryPoint->>Configuration: load_with_env(Env)
Configuration->>Env: string(variable)
Env-->>Configuration: configured value or None
Configuration-->>EntryPoint: resolved configuration
Note over EntryPoint,Env: Production supplies DefaultEnv, tests supply MockEnv
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Replace process-global HNSW test mutation with MockEnv-backed configuration injection, so property tests can run concurrently without unsafe access. Route environment-variable reads through mockable::Env across the workspace and deny the direct std::env methods to prevent regression.
Regenerate the lockfile for the lint-policy branch dependency graph and resolve the rebased test configuration lint findings. Record the isolated property-test timeout experiment and the shared test-binary reader decision for the active lint-policy plan.
Keep the parent branch's `map_or` policy parsing while preserving the injected mockable environment reader. The previous rebase replay left both loader bodies in the implementation block, preventing the test-support crate from compiling.
519396a to
f3c778f
Compare
There was a problem hiding this comment.
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce advisory code health rules
(1 file with String Heavy Function Arguments)
Our agent can fix these. Install it.
Gates Passed
5 Quality Gates Passed
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| process.rs | 1 advisory rule | 9.69 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| tests.rs | 9.39 → 10.00 | Code Duplication |
Absence of Expected Change Pattern
- chutoro/chutoro-core/src/hnsw/tests/property/types.rs is usually changed with: chutoro/chutoro-core/src/hnsw/tests/property/strategies.rs
- chutoro/chutoro-providers/dense/src/simd/tests.rs is usually changed with: chutoro/chutoro-providers/dense/src/simd/kernels.rs
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message in a code block that I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. String Heavy Function Argumentschutoro-test-support/src/process.rs: What lead to degradation?In this module, 41.7% of all arguments to its 7 functions are strings. The threshold for string arguments is 39.0% Why does this problem occur?String is a generic type that fail to capture the constraints of the domain object it represents. In this module, 42 % of all function arguments are string types. How to fix it?Heavy string usage indicates a missing domain language. Introduce data types that encapsulate the semantics. For example, a user_name is better represented as a constrained User type rather than a pure string, which could be anything. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== target module outline =='
ast-grep outline chutoro-test-support/src/process.rs --items all || true
printf '%s\n' '== target module =='
cat -n chutoro-test-support/src/process.rs
printf '%s\n' '== process module references and candidate call sites =='
rg -n -C 4 --glob '*.rs' \
'(?:use\s+.*\bprocess\b|process::|(?:run|run_with|spawn|command|assert).*\()' \
. || true
printf '%s\n' '== tests and exports around target module =='
rg -n -C 4 --glob '*.rs' \
'(?:mod\s+process\b|pub\s+(?:use|mod)\s+process\b|#\[(?:test|tokio::test)\])' \
chutoro-test-support . || true
printf '%s\n' '== workspace package metadata =='
fd -a '^Cargo\.toml$' . -x sh -c 'printf "\n== %s ==\n" "$1"; sed -n "1,160p" "$1"' sh {} \; || trueLength of output: 175151 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== chutoro-test-support/src/process.rs =='
cat -n chutoro-test-support/src/process.rs
printf '%s\n' '== public declarations in target module =='
rg -n -C 2 '^\s*pub(?:\([^)]*\))?\s+(?:struct|enum|type|fn|trait|const|static)\b' \
chutoro-test-support/src/process.rs || true
printf '%s\n' '== imports or qualified references to chutoro_test_support::process =='
rg -n -C 3 --glob '*.rs' \
'(?:chutoro_test_support::process|use\s+chutoro_test_support::\{?[^;]*\bprocess\b|use\s+chutoro_test_support::process)' \
. || true
printf '%s\n' '== target-module test declarations =='
rg -n -C 5 '^\s*(?:#\[(?:test|rstest[^\]]*)\]|fn\s+\w+)' \
chutoro-test-support/src/process.rs || trueLength of output: 11609
Suppress this diagnostic. The current codegraph has one public API, Do not introduce a Paste this into the CodeScene diagnostic suppression field: This module resolves Cargo binary target names and executable file names. The `&str` values are not separate domain entities. They are representations of one externally defined identifier: the Cargo `[[bin]]` name, plus a transient file-name view required for executable-suffix matching.
Introducing a newtype would add conversion and forwarding code without introducing useful validation or preventing invalid states. Cargo owns binary-name semantics, and the file system owns file-name semantics. Keep the small test-support API and its private helpers string-based.You are interacting with an AI system. |
Summary
This change removes process-global environment mutation from the HNSW property
tests. Configuration now flows through injected
mockable::Envobjects, andtests use
MockEnv, so they can execute independently and in parallel.It applies the same injection boundary to the workspace remaining
environment-variable readers and denies direct
std::envmethods that wouldbypass it.
Closes #177
Closes #221
Review walkthrough
DefaultEnv; tests supplyMockEnv.Validation
make check-fmtmake test(1,082 passed; 1 skipped)make typecheckmake lintmake markdownlintmake nixiecoderabbit review --agent --committed --base origin/feat/align-workspace-lint-policy(0 findings)References